#ifndef _DATAPROCESS_H
#define _DATAPROCESS_H

//#ifndef uchar 
#define uchar unsigned char
//#endif

typedef enum _PacketHeaders
{
	Error,
	Command,
	ReadRegister,
	WriteRegister,
	ReadDateTime,
	WriteDateTime,
	RawBatteryAndThermometerData,
	CalBatteryAndThermometerData,
	RawInertialAndMagneticData,
	CalInertialAndMagneticData,
	QuaternionData,
	DigitalIOdata,
	RawAnalogueInputData,
	CalAnalogueInputData,
	PWMoutputData,
	RawADXL345busData,
	CalADXL345busData,
}PacketHeaders;

typedef enum _Qvals
{
    CalibratedGyroscope = 4,
    CalibratedAccelerometer = 11,
    CalibratedMagnetometer = 11,
		Q_pressure = 4,
		Q_flow = 0,
		Q_power = 0,
		Q_pressure_Int = 4,
		Q_flow_Int = 4,
		Q_savePower_int = 4,
		Q_RPM = 0,
}Qvals;

short Concat(uchar MSB, uchar LSB);

//float --> fixed --> decodePacket --> encodePacket:
short FloatToFixed(float floatValue, Qvals q);
void InsertChecksum(uchar * decodePacket,int Length);
void RightShiftByteArray(uchar * byteArray,int Length);
void Encoding(uchar * decodePacket,int de_Length, uchar * encodePacket,int en_Length);
void DataIntoDecodepacket(uchar * decode,float data1,float data2,float data3,\
																	 float data4,float data5,float data6,\
																	 float data7,float data8,float data9);
																	 
//encodePacket --> decodePacket --> short --> float:
void FixedToFloat(float * floatValue, short fixedValue, Qvals q);
void LeftShiftByteArray(uchar * byteArray,int Length);
void Decoding(uchar * encodePacket,int en_Length,uchar * decodePacket,int de_Length);
void DecodepacketIntoData(uchar * decode);
																	 
																 
#endif


																	 